- content_for :title, app.name
- content_for :head do
  = auto_discovery_link_tag :atom, app_path(app, User.token_authentication_key => current_user.authentication_token, :format => "atom"), :title => t('.atom_title', :name => app.name, :host => request.host)
- content_for :meta do
  - if app.current_app_version.present?
    %strong="Latest App Version:"
    = app.current_app_version
  %strong=t('.errors_caught')
  = app.problems.count
  %strong=t('.deploy_count')
  = app.deploys.count
  %strong=t('.api_key')
  = app.api_key
- content_for :action_bar do
  - if current_user.admin?
    = link_to t('.edit'), edit_app_path(app), :class => 'button'
  - if all_errs
    = link_to t('.unresolved_errs'), app_path(app), :class => 'button'
  - else
    = link_to t('.all_errs'), app_path(app, :all_errs => true), :class => 'button'

  - if current_user.watching?(app)
    = link_to t('.unwatch'), app_watcher_path({app_id: app, id: current_user.id}), method: :delete, class: 'button', data: {confirm: t('.are_you_sure')}
%h3#watchers_toggle
  =t('.watchers')
  %span.click_span=t('.show_hide')
#watchers_div
  - if app.notify_all_users
    %table.watchers
      %thead
        %tr
          %th=t('.all_users_notified')
  - else
    %table.watchers
      %thead
        %tr
          %th=t('.user_or_email')
      %tbody
        - app.watchers.each do |watcher|
          %tr
            %td= watcher.label
        - if app.watchers.none?
          %tr
            %td
              %em= t('.no_watcher')

- if app.github_repo?
  %h3#repository_toggle
    =t('.repository')
    %span.click_span=t('.show_hide')
  #repository_div
    %table.repository
      %thead
        %tr
          %th=t('.github_repo')
      %tbody
        %tr
          %td= link_to(app.github_repo, app.github_url, :target => '_blank')

%h3#deploys_toggle
  =t('.latest_deploys')
  %span.click_span=t('.show_hide')
#deploys_div
  - if deploys.any?
    %table.deploys
      %thead
        %tr
          %th=t('.when')
          %th=t('.environment')
          %th=t('.who')
          %th=t('.message')
          %th=t('.repository')
          %th=t('.revision')

      %tbody
        - deploys.each do |deploy|
          %tr
            %td.when #{deploy.created_at.to_s(:micro)}
            %td.environment #{deploy.environment}
            %td.who #{deploy.username}
            %td.message #{deploy.message}
            %td.repository #{deploy.repository}
            %td.revision #{deploy.short_revision}
    = link_to t('.all_deploys', :count => app.deploys.count), app_deploys_path(app), :class => 'button'
  - else
    %h3=t('.no_deploys')

- if app.problems.any?
  %h3.clear=t('.errors')
  %section
    = render 'problems/search', :all_errs => @all_errs, :app_id => app.id
  %br
  %section
    .problem_table{:id => 'problem_table'}
      = render 'problems/table', :problems => problems
- else
  %h3.clear=t('.no_error_yet')
  = render 'configuration_instructions', :app => app

